package com.tr.rentcar.controller.houtai;

import java.io.IOException;
import java.io.PrintWriter;
import java.sql.SQLException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.tr.rentcar.model.dao.AdminDao;

@WebServlet("/singledelete")
public class SingledeleteControllor extends HttpServlet {
	AdminDao admindao = new AdminDao();
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		try {
			String aid = req.getParameter("aid");
			Integer id = Integer.parseInt(aid);
			String deleteid = req.getParameter("deleteid");
			Integer deleteId = Integer.parseInt(deleteid);
			if (deleteId == 1) {
				resp.getWriter().println(admindao.admindeletebyid(id));
				//resp.sendRedirect(req.getContextPath() + "/houtaiadmin");
			}

		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	}

	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		doGet(req, resp);
	}

}
